<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Insert title here</title>
        <link rel="stylesheet" type="text/css" href="<?php echo $this->pubUrl ?>share/css/reset.css"/>
        <link rel="stylesheet" type="text/css" href="<?php echo $this->pubUrl ?>share/js/easyui/themes/default/layout.css"/>
        <link rel="stylesheet" type="text/css" href="<?php echo $this->pubUrl ?>share/js/easyui/themes/default/panel.css"/>
        <link rel="stylesheet" type="text/css" href="<?php echo $this->pubUrl ?>share/css/ztree/default.css"/>
        <script type="text/javascript" src="<?php echo $this->pubUrl ?>share/js/jquery/jquery.js"></script>
        <script type="text/javascript" src="<?php echo $this->pubUrl ?>share/js/jquery/jquery.ztree.js"></script>
        <script type="text/javascript" src="<?php echo $this->pubUrl ?>share/js/easyui/jquery.easyui.js"></script>
        <script type="text/javascript">
            var isLogin = false;
            <?php if($this->identity->isLogin()):?>
            isLogin = true;
            <?php endif; ?>
            if(!isLogin){
                top.location.href = '/logout.html';
            }

          var menus =[
		  <?php if($this->identity->isInRole('article_editor')): ?>
		  { name:"文章管理", open:true, nodes:[
		  	<?php if($this->identity->isInRole('article_manager')): ?>
		    { name:"文章分类", url:"/backend/article/category/index", target:"main_frame"},
		    <?php endif ?>
			{ name:"文章列表", url:"/backend/article/content/index", target:"main_frame"}
		  ]},
		  <?php endif; ?>
		  <?php if($this->identity->isInRole('promotion_editor')): ?> 
		  { name:"推广管理", open:true, nodes:[                      
	          	{name:"广告列表", url:"/backend/promotion/ad/index", target:"main_frame"},
	          	{name:"友情链接", url:"/backend/promotion/friendlink/index", target:"main_frame"},
	         	{name:"优惠列表", url:"/backend/promotion/concessions/index", target:"main_frame"},
	          <?php if($this->identity->isInRole('promotion_manager')): ?>
            	{name:"优惠分类", url:"/backend/promotion/concessions/category-index", target:"main_frame"},
			  <?php endif; ?>
			  <?php if($this->identity->isInRole('promotion_manager')):?>
            	{name:"推广位置", url:"/backend/promotion/position/index", target:"main_frame"}
              <?php endif; ?>	
          ]},          
          <?php endif; ?>
          <?php if($this->identity->isInRole('customer_editor')): ?>
          { name:"客户管理", open:true, nodes:[
 			{ name:"客户列表", url:"/backend/customer/index/index", target:"main_frame"}
 		  ]},
          <?php endif; ?>
          <?php if($this->identity->isInRole('subject_editor')): ?>
          	{ name:"主题管理", open:true, nodes:[
          	<?php if($this->identity->isInRole('subject_manager')): ?>
          	{ name:"主题分类", url:"/backend/subject/category/index", target:"main_frame"},
          	<?php endif; ?>
          	{ name:"主题列表", url:"/backend/subject/content/index", target:"main_frame"}   
          	]},    
          <?php endif; ?>       
          <?php if($this->identity->isInRole('ebook_manager')): ?>     
          { name:"EBook管理", open:true, nodes:[      
	          <?php if($this->identity->isAllowAction('ebook_read')):?>
	          	{name:"EBook列表", url:"/backend/ebook/index/index", target:"main_frame"},
	          <?php endif;?>            
	          <?php if($this->identity->isAllowAction('ebook_material_read')):?>
	            {name:"素材列表", url:"/backend/ebook/material/index", target:"main_frame"},
	          <?php endif; ?>
	      ]},
          <?php endif; ?>
          { name:"资源管理", open:true, nodes:[       
          	{ name:"POI列表", url:"/backend/foundation/poi/index", target:"main_frame"},
          	{ name:"路段列表", url:"/backend/foundation/road/index", target:"main_frame"},
          	{ name:"行业列表", url:"/backend/foundation/industry/index", target:"main_frame"},
          <?php if($this->identity->isInRole('resource_assigner')): ?>
 			{ name:"分配主题资源", url:"/backend/resource/subject/index", target:"main_frame"},
   			{ name:"分配用户资源", url:"/backend/resource/account/index", target:"main_frame"}
   		  <?php endif; ?>       
          ]},       	        
           <?php if($this->identity->isSuperAdmin()): ?>     
            { name:"网站设计", open:true,   
                    nodes:[{ name:"页面模板", url:"/backend/design/page_template/index", target:"main_frame"},
                           { name:"页面位置", url:"/backend/design/page_position/index", target:"main_frame"},
                           { name:"模块管理", url:"/backend/design/block/index", target:"main_frame"},
                           { name:"模块模板", url:"/backend/design/block_template/index", target:"main_frame"},
                           { name:"页面主题", url:"/backend/design/page_theme/index", target:"main_frame"},
                           { name:"网站主题", url:"/backend/design/website_theme/index", target:"main_frame"}]
            },           
            { name:"权限管理", open:true,
                    nodes:[{ name:"账号管理", url:"/backend/permission/account/index", target:"main_frame"},
                           { name:"角色管理", url:"/backend/permission/role/index", target:"main_frame"},
                           { name:"行为管理", url:"/backend/permission/action/index", target:"main_frame"},
                           { name:"操作授权", url:"/backend/permission/accredit_action/index", target:"main_frame"}]
            },
            { name:"系统管理", open:true,
                    nodes:[{ name:"域管理", url:"/backend/global/area/index", target:"main_frame"},
                           { name:"组件管理", url:"/backend/global/component/index", target:"main_frame"},
                    ]
            },
            <?php endif; ?>            
    	      ];
            $(function () {
            	$('body').layout('panel','west');
                $("#tree").zTree({showLine:false}, menus);
            });
        </script>
    </head>
    <body class="easyui-layout" style="margin:5px;">
        <div region="north" border="true" style="overflow:hidden;height:20px;">
            <a href="<?php echo $this->getUrl(NULL, 'password') ?>" target="main_frame">修改密码</a>
            <a onclick="location.replace(this.href);event.returnValue=false;" href="/backend/index/index/logout">退出</a>
        </div>
        <div region="west" split="true" border="false" title="功能菜单" style="width:150px;">
            <ul id="tree" class="ztree"></ul>
        </div>
        <div id="center_panel" region="center" split="true" border="false">
            <iframe id="main_frame" name="main_frame" width="100%" height="99%" frameborder="0" scrolling="auto" src="#"></iframe>
        </div>
    </body>
</html>